/**
* Created by czg on 2019/1/10 0010 Time: 19:40 .
*/

<template lang="html">
    <div class="bg">
    <div class="information-container" ref="box" :style="{'height':boxh+'px','width':boxw+'px'}">
        <div v-html="info" v-if="isStatic"></div>
    </div>
    </div>
</template>
<script>
  import axios from 'axios'
  export default {
    name: 'information',
    created () {
      this.getInfo()
      this.clientHeight = `${document.documentElement.clientHeight}`;
      this.clientWidth=`${document.documentElement.clientWidth}`;
      this.boxh=this.clientHeight ;
      this.boxw=this.clientWidth;
    },
    methods: {
      getInfo () {
        axios.post('https://vip.gznewpark.com/dist/admin/public/index.php/wx/Shop/index').then(res => {
          this.info = res.data.result.desc.content
          this.url = res.data.result.desc.url
          const isUrl = res.data.result.desc.is_url
          if (isUrl == 0) {
            this.isStatic = true
          } else {
            window.location.href = this.url
            window.history.pushState('', '', '#')
            window.addEventListener('popstate',function(e){
              window.location.replace('/index')
            })
          }
        })
      }
    },
    data () {
      return {
        info: '',
        isStatic: false,
        clientHeight:'',
        clientWidth:'',
        boxh:'',
        boxw:''
      }
    }
  }
</script>

<style lang="less">
    .bg{
        background: url("../../static/bg.png") no-repeat center center;
        background-size: cover;
        background-attachment: fixed;
        overflow: auto;
        box-sizing: border-box;
        padding:0px!important;
    }
    .information-container{
        box-sizing: border-box;
        padding: 0px!important;
        width: 100%;
        height: 100%;
        overflow-y: scroll;
    }
.information-container img{
    width: 100%;
    height: auto;
}
</style>
